package com.ryan.demo.dom4j.utils;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class Dom4jParser {

	public String createXml(){

		Document document = DocumentHelper.createDocument();
		Element request = document.addElement("request");
		Element orderNum = request.addElement("orderNum");
		orderNum.setText("你好");
		Element merchantId = request.addElement("merchantId");
		merchantId.setText("世界");
		Element createTime = request.addElement("createTime");
		createTime.setText("helloworld");
		
		Element models = request.addElement("models");
//		生成merchant节点
		Element merchant = models.addElement("merchant");
		merchant.setText("ceshi");
		return document.asXML();
	}
	
}
